package com.x.erp.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.MultilevelActivityShareDao;
import com.x.erp.manage.MultilevelActivityShareManage;
import com.x.erp.model.MultilevelActivityShare;
import com.x.erp.rpc.MultilevelActivityShareRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 多级营销活动分享记录服务
 */
@Component
@Service(interfaceName = "com.x.erp.rpc.MultilevelActivityShareRpcService", timeout = 60000)
public class MultilevelActivityShareService extends BaseService implements MultilevelActivityShareRpcService {

	@Autowired
	private MultilevelActivityShareDao multilevelActivityShareDao;//多级营销活动分享记录信息DAO

	@Autowired
	private MultilevelActivityShareManage multilevelActivityShareManage;//多级营销活动分享记录信息Manage

	/**
	 * 查询多级营销活动分享记录列表
	 * @param multilevelActivityShare
	 * @return
	 */
	@Override
	public List<MultilevelActivityShare> selectMultilevelActivityShareList(MultilevelActivityShare multilevelActivityShare){
		try {
			return multilevelActivityShareDao.selectMultilevelActivityShareList(multilevelActivityShare);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 查询多级营销活动分享记录数量
	 * @param multilevelActivityShare
	 * @return
	 */
	@Override
	public int selectMultilevelActivityShareNum(MultilevelActivityShare multilevelActivityShare){
		try {
			return multilevelActivityShareDao.selectMultilevelActivityShareNum(multilevelActivityShare);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 新增多级营销活动分享记录信息
	 * @param multilevelActivityShare
	 * @return
	 */
	@Override
	public MultilevelActivityShare insertMultilevelActivityShare(MultilevelActivityShare multilevelActivityShare){
		try {
			return multilevelActivityShareManage.insertMultilevelActivityShare(multilevelActivityShare);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 修改多级营销活动分享记录信息
	 * @param multilevelActivityShare
	 * @return
	 */
	@Override
	public int updateMultilevelActivityShare(MultilevelActivityShare multilevelActivityShare){
		try {
			return this.update(multilevelActivityShare);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	@Override
	public int deleteMultilevelActivityShare(MultilevelActivityShare multilevelActivityShare) {
		try {
			return this.delete(multilevelActivityShare);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

}
